home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / batch / library / batutl2 / waitn.asm < prev    next >
Assembly Source File  |  1988-04-20  |  1KB  |  55 lines

  1. TITLE    WAITN    11-12-83    [4-19-88]
  2. ;Toad Hall Disassembly, tweak
  3.  
  4. CR    EQU    0DH
  5. ;
  6. ;INITIAL VALUES :    CS:IP    0000:0100
  7. ;            SS:SP    0000:FFFF
  8. CodeSeg    SEGMENT
  9.     ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
  10.     ORG    100H
  11.  
  12. WaitN    proc    near
  13.     MOV    SI,80H        ;DOS PSP cmd line
  14.     CLD            ;insure fwd
  15.     LODSB            ;snarf cmd line length byte
  16.     OR    AL,AL        ;anything there?
  17.     JZ    Exit        ; nope, exit right now
  18.  
  19.     MOV    CL,AL        ;save length in CL
  20.     MOV    AL,1
  21.     MOV    BL,0AH        ;multiply by 10's
  22. Lup10F:    MUL    BL        ;*10
  23.     DEC    CL        ;decrement
  24.     JNZ    Lup10F
  25.     MOV    BX,AX        ;number base is now in BX
  26. CmdBufLup:
  27.     LODSB
  28.     CMP    AL,CR        ;end of cmd line?
  29.     JZ    Exit        ; yep, go exit
  30.     CMP    AL,'1'        ;legal digit?
  31.     JB    CmdBufLup    ; nope, ignore, reloop
  32.     PUSH    AX        ;save the digit
  33.     MOV    CL,0AH        ;/10
  34.     MOV    AX,BX        ;number base
  35.     DIV    CL        ; /10
  36.     MOV    BX,AX        ;restore in bx
  37.     POP    AX        ;restore digit
  38.     xor    ah,ah        ;clear msb
  39.     SUB    AL,30H        ;de-asciify
  40.     MUL    BX        ;* number base
  41. Lup131:    CMP    AX,1        ;not done yet
  42.     JB    CmdBufLup    ;timed out, keep processing cmd line
  43.     MOV    CX,65FFH    ;delay constant
  44. Delay_139:
  45.     LOOP    Delay_139    ;delay a while
  46.     DEC    AX        ;decrement our counter
  47.     JMP    SHORT    Lup131    ; and see if we're done
  48.  
  49. Exit:    INT    20H        ;terminate
  50.  
  51. Waitn    endp
  52.  
  53. CodeSeg    ENDS
  54.     END    WaitN
  55.